﻿using RM.Controls;
using System.Drawing.Design;
using System.Windows.Forms.Design;

namespace MESPro.Controls
{
    /// <summary>
    /// 返回选择的存储过程
    /// </summary>
    public class PropertyReturnStoreProcedure : UITypeEditor
    {
        #region Public 方法

        public override UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
        {
            return UITypeEditorEditStyle.Modal;
        }

        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.
IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService edSvc =
                (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                // 可以打开任何特定的对话框

                ShowStoreProcedureLIst dialog = new ShowStoreProcedureLIst();

                var res = dialog.ShowDialog();
             
                return dialog.StoreProInfo;
            }

            return value;
        }

        #endregion Public 方法
    }
}